<?php
require '../../config.php';
/**
 * 获取用户邮箱对应的头像
 */
//1、获取客户端传过来的邮箱
if (empty($_GET['email'])) {
	exit('<h1>缺少必要参数</h1>');
}
$email = $_GET['email'];
//2、查询到邮箱所对应的头像
$conn = mysqli_connect(XIU_DB_HOST, XIU_DB_USER, XIU_DB_PASS, XIU_DB_NAME);
if (!$conn) {
	exit('<h1>连接数据库失败</h1>');
}
 $query = mysqli_query($conn,"select avatar from users where email = '{$email}' limit 1;");
 if (!$query) {
 	exit('<h1>数据查询失败</h1>');
 }
 $rows = mysqli_fetch_assoc($query);
 if (!$rows) {
 	exit('<h1>没有数据</h1>');
 }
echo $rows['avatar'];